package org.budo.cmbc.direct.sdk.entity;

import java.io.Serializable;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;

import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;

/**
 * @author lmw
 */
@Getter
@Setter
@NoArgsConstructor
@Accessors(chain = true)
@ToString
public class AbstractCmbcDirectResponse implements Serializable {
    private static final long serialVersionUID = -755109994278218292L;

    private final String channelJnlNoFlag = "ChannelJnlNo";

    private String code;

    private String message;

    private String channelJnlNo;

    public AbstractCmbcDirectResponse(String channelJnlNo, String responseJson) {
        JSONObject jsonObject = JSON.parseObject(responseJson);

        this.setCode(jsonObject.getString("code")) //
                .setMessage(jsonObject.getString("message")) //
                .setChannelJnlNo(channelJnlNo);
    }
}